/*
 * @lc app=leetcode.cn id=49 lang=swift
 *
 * [49] 字母异位词分组
 */

// @lc code=start
class Solution {
    func groupAnagrams(_ strs: [String]) -> [[String]] {
        var group: [String: [String]] = [:]
        for str in strs {
            group[String(str.sorted()), default: []].append(str)
        }
        return Array(group.values)
    }
}
// @lc code=end

